<template>
    <view class="container-scope animated data-v-645b880e">
        <view class="waiting-card data-v-645b880e" v-if="isNotOpen">
            <view class="title data-v-645b880e" style="margin-top: 60rpx">抢购用户太多了</view>
            <view class="title data-v-645b880e" style="margin-top: 20rpx">请不要离开此页面，等待几秒后刷新哦~</view>
            <view class="bottom data-v-645b880e">
                <view class="button-c data-v-645b880e">
                    <view @tap="__e" class="btn confirm bg-purple data-v-645b880e" :data-event-opts="[['tap', [['handleRefresh', ['$event']]]]]">立即刷新</view>
                </view>
            </view>
        </view>
        <view class="content-scope data-v-645b880e" :style="doubleBoxCard == 1 ? 'margin-top:0;' : ''" v-else>
            <view @tap="__e" class="free-order-c data-v-645b880e" :data-event-opts="[['tap', [['viewFreeOrderDetail', ['$event']]]]]" v-if="package.free_order_total">
                <text class="data-v-645b880e">{{ '恭喜您获得' + package.free_order_total + '发免单' }}</text>
                <text class="new-iconfont icon-arrow-right data-v-645b880e"></text>
            </view>
            <view class="data-v-645b880e" v-if="!isOpen"></view>
            <view class="data-v-645b880e" style="min-height: 800rpx" v-else>
                <view class="data-v-645b880e" style="width: 686rpx; height: 106rpx; margin: 200rpx auto 24rpx">
                    <image class="data-v-645b880e" src="https://img121.7dun.com/yuanqimali/share/choushanghuode.png" style="width: 100%; height: 100%"></image>
                </view>
                <scroll-view class="scroll-view-212 data-v-645b880e" :scrollY="true">
                    <scroll-view class="data-v-645b880e" :scrollY="true" style="height: 41vh">
                        <view class="sku-list data-v-645b880e">
                            <view
                                @tap="__e"
                                class="sku-item data-v-645b880e"
                                :data-event-opts="[['tap', [['checkSku', ['$0'], [[['skus', '', index]]]]]]]"
                                v-for="(item, index) in skus"
                                :key="index"
                            >
                                <view
                                    class="item-top data-v-645b880e"
                                    :style="
                                        'background-image:' +
                                        (item.level == 1 ? bkImgs[0] : item.level == 2 ? bkImgs[1] : item.level == 4 ? bkImgs[2] : item.level == 5 ? bkImgs[3] : bkImgs[4]) +
                                        ';'
                                    "
                                >
                                    <view :class="['level_icon', 'data-v-645b880e', item.options.shang_type === 1 ? 'gift' : '']" v-if="item.level_icon">
                                        <image class="data-v-645b880e" mode="heightFix" :src="item.level_icon"></image>
                                    </view>
                                    <image class="item-top-img data-v-645b880e" :src="item.thumb"></image>
                                    <view class="item-top-total data-v-645b880e" v-if="item.total !== 1">{{ 'x' + item.total }}</view>
                                </view>

                                <view class="money_box data-v-645b880e" v-if="item.money_price / 100 > 100">
                                    <text class="data-v-645b880e">{{ '￥' + item.money_price / 100 }}</text>
                                </view>

                                <view class="item-bottom data-v-645b880e">
                                    <view class="item-bottom-title data-v-645b880e">{{ item.title }}</view>
                                    <view class="price_box data-v-645b880e" v-if="myInfo.level > 4">
                                        分解:
                                        <text class="data-v-645b880e">{{ item.fj_score }}</text>
                                        {{ scoreAlias }}
                                    </view>
                                </view>
                            </view>
                        </view>
                    </scroll-view>
                    <view class="scroll-alias data-v-645b880e" v-if="myInfo.level > 4">
                        <view class="data-v-645b880e" style="text-align: center; color: #9df9fc; font-size: 32rpx">{{ '一键分解可获得：' + total_score_score + scoreAlias }}</view>
                        <view class="data-v-645b880e" style="text-align: center; color: #9df9fc; font-size: 32rpx" v-if="doubleBoxCard == 1">
                            {{ '双倍卡额外获得：' + total_score_score + scoreAlias }}
                        </view>
                    </view>
                </scroll-view>
            </view>
            <view class="bottom data-v-645b880e" v-if="showResult">
                <view class="luck-tips data-v-645b880e"></view>
                <view class="button-c data-v-645b880e" v-if="istry">
                    <view @tap="__e" class="btn confirm bg-purple onekey_recycle_try data-v-645b880e" :data-event-opts="[['tap', [['onekeyrecycle_try', ['$event']]]]]"></view>
                    <view
                        @tap="__e"
                        class="btn return-sale continue_try data-v-645b880e"
                        :data-event-opts="[['tap', [['close', ['$event']]]]]"
                        v-if="!orderConfig.is_ban_return_sale"
                    ></view>
                </view>
                <view class="button-c data-v-645b880e" v-else>
                    <view class="data-v-645b880e" style="display: flex; width: 100%; justify-content: space-around" v-if="myInfo.level > 4">
                        <view @tap="__e" class="btn confirm onekey_recycle data-v-645b880e" :data-event-opts="[['tap', [['onekeyrecycle', ['$event']]]]]">
                            <image class="data-v-645b880e" src="https://img121.7dun.com/yuanqimali/share/yijianfenjie.png"></image>
                        </view>
                        <view
                            @tap="__e"
                            class="btn return-sale continue data-v-645b880e"
                            :data-event-opts="[['tap', [['close', ['$event']]]]]"
                            v-if="!orderConfig.is_ban_return_sale"
                        >
                            <image class="data-v-645b880e" src="https://img121.7dun.com/yuanqimali/share/jixuchoushang.png"></image>
                        </view>
                    </view>
                    <view class="data-v-645b880e" style="display: flex; width: 100%; justify-content: center" v-else>
                        <view
                            @tap="__e"
                            class="btn return-sale continue data-v-645b880e"
                            :data-event-opts="[['tap', [['close', ['$event']]]]]"
                            v-if="!orderConfig.is_ban_return_sale"
                        >
                            <image class="data-v-645b880e" src="https://img121.7dun.com/yuanqimali/share/jixuchoushang.png"></image>
                        </view>
                    </view>
                </view>
                <view class="luck-tips-zhuyi data-v-645b880e" v-if="myInfo.level > 4">{{ '注意：分解获得' + scoreAlias + '仅作消费使用,不可提现。' }}</view>
            </view>
        </view>
        <return-sale-popup
            @__l="
                __l($event, {
                    eventOpts: [
                        ['^cancel', [['e0']]],
                        ['^refresh', [['e1']]]
                    ]
                })
            "
            @cancel="
                __e($event, {
                    eventOpts: [
                        ['^cancel', [['e0']]],
                        ['^refresh', [['e1']]]
                    ]
                })
            "
            @refresh="
                __e($event, {
                    eventOpts: [
                        ['^cancel', [['e0']]],
                        ['^refresh', [['e1']]]
                    ]
                })
            "
            class="data-v-645b880e"
            :data-event-opts="[
                ['^cancel', [['e0']]],
                ['^refresh', [['e1']]]
            ]"
            :uuid="orderUuid"
            vueId="ca6a817c-1"
            v-if="isShowReturnSale"
        ></return-sale-popup>
    </view>
</template>

<script>
import returnSalePopup from '@/components/ReturnSalePopup/ReturnSalePopup';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['components/OpenBoxPopupTheme2/OpenBoxPopupTheme2'],
    {
        '6f84': function (e, t, n) {
            'use strict';

            var o = n('d2f1');
            n.n(o).a;
        },
        '6fe8': function (e, t, n) {
            'use strict';

            n.d(t, 'b', function () {
                return r;
            });
            n.d(t, 'c', function () {
                return i;
            });
            n.d(t, 'a', function () {
                return o;
            });
            var o = {
                ReturnSalePopup: function () {
                    return n.e('components/ReturnSalePopup/ReturnSalePopup').then(n.bind(null, 'f4ef'));
                }
            };
            var r = function () {
                var that = this;
                that.$createElement;
                that._self._c;
                that._isMounted ||
                    ((that.e0 = function (t) {
                        that.isShowReturnSale = false;
                    }),
                    (that.e1 = function (t) {
                        that.isReturnSaleSuccess = true;
                    }));
            };
            var i = [];
        },
        8343: function (e, t, n) {
            'use strict';

            (function (e) {
                function n(e, t) {
                    var n = ('undefined' != typeof Symbol && e[Symbol.iterator]) || e['@@iterator'];
                    if (!n) {
                        if (
                            Array.isArray(e) ||
                            (n = (function (e, t) {
                                if (e) {
                                    if ('string' == typeof e) {
                                        return o(e, t);
                                    }
                                    var n = Object.prototype.toString.call(e).slice(8, -1);
                                    if ('Object' === n && e.constructor) {
                                        n = e.constructor.name;
                                    }
                                    return 'Map' === n || 'Set' === n ? Array.from(e) : 'Arguments' === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? o(e, t) : void 0;
                                }
                            })(e)) ||
                            (t && e && 'number' == typeof e.length)
                        ) {
                            if (n) {
                                e = n;
                            }
                            var r = 0;
                            var i = function () {};
                            return {
                                s: i,
                                n: function () {
                                    return r >= e.length
                                        ? {
                                              done: true
                                          }
                                        : {
                                              done: false,
                                              value: e[r++]
                                          };
                                },
                                e: function (e) {
                                    throw e;
                                },
                                f: i
                            };
                        }
                        throw new TypeError(
                            'Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'
                        );
                    }
                    var a;
                    var s = true;
                    var u = false;
                    return {
                        s: function () {
                            n = n.call(e);
                        },
                        n: function () {
                            var e = n.next();
                            s = e.done;
                            return e;
                        },
                        e: function (e) {
                            u = true;
                            a = e;
                        },
                        f: function () {
                            try {
                                s || null == n.return || n.return();
                            } finally {
                                if (u) {
                                    throw a;
                                }
                            }
                        }
                    };
                }
                function o(e, t) {
                    if (null == t || t > e.length) {
                        t = e.length;
                    }
                    for (n = 0, o = new Array(t), void 0; n < t; n++) {
                        var n;
                        var o;
                        o[n] = e[n];
                    }
                    return o;
                }
                Object.defineProperty(t, '__esModule', {
                    value: true
                });
                t.default = void 0;
                var r = {
                    props: {
                        boxImg: String,
                        buttonTitle: String,
                        order: Object,
                        tryMode: Boolean,
                        tryInfo: Object,
                        info: Object,
                        isNavbarEnable: false,
                        levelskus: Array,
                        sku_level: Array,
                        doubleBoxCard: Number,
                        shangbaoType: String
                    },
                    data: function () {
                        return {
                            bkImgs: [
                                'url(https://img121.7dun.com/20230207NewImg/huanxiang/wuxianR.png)',
                                'url(https://img121.7dun.com/20230207NewImg/huanxiang/wuxianSr.png)',
                                'url(https://img121.7dun.com/20230207NewImg/huanxiang/wuxianSsr.png)',
                                'url(https://img121.7dun.com/20230207NewImg/huanxiang/wuxianUr.png)',
                                'url()'
                            ],
                            isOpen: false,
                            showResult: false,
                            status: 0,
                            isShowReturnSale: false,
                            isReturnSaleSuccess: false,
                            package: {},
                            defaultBoxImage: 'https://cdn2.hquesoft.com/box/openbox.png',
                            isNotOpen: false,
                            selectedIds: [],
                            total_money_price: 0,
                            total_score_price: 0,
                            total_score_score: 0,
                            myInfo: {}
                        };
                    },
                    mounted: function () {
                        this.initData();
                        this.getMyInfo();
                    },
                    computed: {
                        skus: function () {
                            return this.package.skus || [];
                        },
                        orderConfig: function () {
                            return this.$store.getters.setting.order;
                        },
                        rewardJikaTimes: function () {
                            return this.package.reward && this.package.reward.jika_times;
                        },
                        rewardLotteryTicket: function () {
                            return this.package.reward && this.package.reward.lottery_ticket;
                        }
                    },
                    methods: {
                        getMyInfo: function () {
                            var that = this;
                            this.$http('/task/level_list?no_list=1')
                                .then(function (t) {
                                    that.myInfo = t.data.my_task_level_info;
                                })
                                .catch(function (e) {
                                    console.log(e);
                                });
                        },
                        viewFreeOrderDetail: function () {
                            this.info.money_price
                                ? e.navigateTo({
                                      url: '/pages/myRedpack/index'
                                  })
                                : e.navigateTo({
                                      url: '/pages/myScore/index'
                                  });
                        },
                        initData: function () {
                            var that = this;
                            this.tryMode
                                ? (e.showLoading(),
                                  this.$http('/try/packages/'.concat(this.tryInfo.package_uuid)).then(function (n) {
                                      that.package = n.data;
                                      that.startOpenAnimate();
                                      e.hideLoading();
                                  }))
                                : this.$http('/asset/package?order_id='.concat(this.order.id))
                                      .then(function (e) {
                                          that.package = e.data;
                                          for (var o = 0; o < that.levelskus.length; o++) {
                                              for (var r = 0; r < that.package.skus.length; r++) {
                                                  if (that.levelskus[o].title == that.package.skus[r].title) {
                                                      that.package.skus[r].level = that.levelskus[o].level;
                                                      for (var i = 0; i < that.sku_level.length; i++) {
                                                          if (that.sku_level[i].level == that.package.skus[r].level) {
                                                              that.package.skus[r].level_icon = that.sku_level[i].icon;
                                                              that.package.skus[r].level_title = that.sku_level[i].title;
                                                          }
                                                      }
                                                  }
                                              }
                                          }
                                          console.log(that.package.skus, '666');
                                          that.startOpenAnimate();
                                          var a;
                                          var s = n(that.package.skus);
                                          try {
                                              for (s.s(); !(a = s.n()).done; ) {
                                                  var u = a.value;
                                                  that.total_score_score += u.fj_score * u.total;
                                                  that.total_money_price += u.money_price * u.total;
                                                  that.total_score_price += u.score_price * u.total;
                                                  if (u.money_price > 10000) {
                                                      for (var c = 0; c < u.total; c++) {
                                                          var l = {
                                                              order_id: e.data.id,
                                                              thumb: u.thumb,
                                                              title: u.title,
                                                              money_price: that.money_price_title(u.title)
                                                          };
                                                          that.getScorePack(u.money_price, JSON.stringify(l));
                                                      }
                                                  }
                                              }
                                          } catch (e) {
                                              console.log('CatchClause', e);
                                              console.log('CatchClause', e);
                                              s.e(e);
                                          } finally {
                                              s.f();
                                          }
                                          console.log('this.levelskus=>', that.levelskus);
                                          if (1 == that.doubleBoxCard) {
                                              that.usecard(that.total_money_price, that.total_score_price);
                                          }
                                      })
                                      .catch(function (e) {
                                          that.isNotOpen = true;
                                      });
                        },
                        money_price_title: function (e) {
                            for (var t = 0; t < this.levelskus.length; t++) {
                                if (this.levelskus[t].title == e) {
                                    return this.levelskus[t].money_price;
                                }
                            }
                            return 0;
                        },
                        getScorePack: function (t, n) {
                            if ('renyi' != this.shangbaoType) {
                                e.showToast({
                                    title: '恭喜你获取到一个赏包',
                                    icon: 'none'
                                });
                                this.$http('/create_score_redpack', 'post', {
                                    worth: t / 100,
                                    description: n
                                }).then(function (e) {});
                            }
                        },
                        usecard: function (e, t) {
                            this.$http('/fudai/use-card', 'post', {
                                card_type: 'double_box',
                                money_price: e,
                                score_price: t
                            }).then(function (e) {});
                        },
                        onekeyrecycle: function () {
                            var that = this;
                            e.showLoading({
                                title: '分解中...',
                                success: function (o) {
                                    var r;
                                    var i = n(that.skus);
                                    try {
                                        for (i.s(); !(r = i.n()).done; ) {
                                            var a = r.value;
                                            that.selectedIds.push(a.id);
                                        }
                                    } catch (e) {
                                        console.log('CatchClause', e);
                                        console.log('CatchClause', e);
                                        i.e(e);
                                    } finally {
                                        i.f();
                                    }
                                    that.$http('/asset/return-sale/confirm', 'post', {
                                        ids: that.selectedIds
                                    }).then(function (n) {
                                        that.isReturnSaleSuccess = 0;
                                        e.showToast({
                                            title: '分解成功'
                                        });
                                        that.refresh();
                                        that.isSelectMode = false;
                                        that.$emit('refresh');
                                    });
                                }
                            });
                            this.close();
                        },
                        startOpenAnimate: function () {
                            var that = this;
                            setTimeout(function () {
                                that.status = 1;
                                setTimeout(function () {
                                    that.isOpen = true;
                                    that.$playAudio('open');
                                    setTimeout(function () {
                                        that.showResult = true;
                                    }, 300);
                                }, 200);
                            }, 100);
                        },
                        handleRefresh: function () {
                            this.isNotOpen = false;
                            this.initData();
                        },
                        goLotteryDetail: function () {
                            e.navigateTo({
                                url: '/pages/lottery/detail?uuid=' + this.rewardLotteryTicket.uuid
                            });
                        },
                        goJikaDetail: function () {
                            e.navigateTo({
                                url: '/pages/jika/detail?uuid=' + this.rewardJikaTimes.uuid
                            });
                        },
                        returnSale: function () {
                            e.navigateTo({
                                url: '/pages/myBox/index'
                            });
                        },
                        handleOk: function () {
                            e.navigateTo({
                                url: '/pages/myBox/index'
                            });
                        },
                        goBack: function () {
                            e.navigateBack({
                                delta: 1
                            });
                        },
                        close: function () {
                            this.$emit('close');
                            this.$emit('refresh');
                        },
                        checkSku: function (t) {
                            'score' === t.sku_type
                                ? e.navigateTo({
                                      url: '/pages/myScore/index'
                                  })
                                : 'coupon' === t.sku_type
                                ? e.navigateTo({
                                      url: '/pages/myCoupons/index'
                                  })
                                : 'redpack' === t.sku_type &&
                                  e.navigateTo({
                                      url: '/pages/myRedpack/index'
                                  });
                        }
                    }
                };
                t.default = r;
            }.call(this, n('543d').default));
        },
        d2f1: function (e, t, n) {},
        d4b0: function (e, t, n) {
            'use strict';

            n.r(t);
            var o = n('8343');
            var r = n.n(o);
            for (var i in o) {
                if (['default'].indexOf(i) < 0) {
                    (function (e) {
                        n.d(t, e, function () {
                            return o[e];
                        });
                    })(i);
                }
            }
            t.default = r.a;
        },
        e39b: function (e, t, n) {
            'use strict';

            n.r(t);
            var o = n('6fe8');
            var r = n('d4b0');
            for (var i in r) {
                if (['default'].indexOf(i) < 0) {
                    (function (e) {
                        n.d(t, e, function () {
                            return r[e];
                        });
                    })(i);
                }
            }
            n('6f84');
            var a = n('f0c5');
            var s = Object(a.a)(r.default, o.b, o.c, false, null, '645b880e', null, false, o.a, void 0);
            t.default = s.exports;
        }
    }
]);
(global.webpackJsonp = global.webpackJsonp || []).push([
    'components/OpenBoxPopupTheme2/OpenBoxPopupTheme2-create-component',
    {
        'components/OpenBoxPopupTheme2/OpenBoxPopupTheme2-create-component': function (e, t, n) {
            n('543d').createComponent(n('e39b'));
        }
    },
    [['components/OpenBoxPopupTheme2/OpenBoxPopupTheme2-create-component']]
]);
</script>
<style>
@import './OpenBoxPopupTheme2.css';
</style>
